package icu.lookyousmileface.cas;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author starrysky
 * @title: CasUse
 * @projectName Juc_Pro
 * @description: Cas
 * @date 2021/1/307:54 下午
 */
public class CasUse {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(12);

        System.out.println(atomicInteger.compareAndSet(12, 66));
        System.out.println(atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(66, 99));
        System.out.println(atomicInteger.get());

    }
}
